//@ sourceURL=HealthFileView.js
Ext.ns("HealthFileView");
HealthFileView = Ext.extend(Ext.Panel, {
    constructor : function(a) {
        Ext.applyIf(this, a);
        var all=this.initUIComponents();
        HealthFileView.superclass.constructor.call(this, {
            id : "HealthFileView",
            title : "职业健康危害因素",
            region : "center",
            layout : "border",
            border : false,
            iconCls : "menu-position",
            items : [all.yearGridPanel,all.yearGridSearchPanel,all.yearGridTreePanel]
        });
    },
    initUIComponents : function() {
        var yearGridComponents=new createyeargridview({
            topbar : {
                inputFormName : 'HealthFileForm',
                topbarAdd:{
                    hidden:false
                },
                topbarDel:{
                    hidden:false
                }
            },
            search : {
                items : [ {
                    style : "margin:5px 5px 5px 5px;",
                    text : "员工编号"
                }, {
                    columnWidth : 0.2,
                    xtype : "textfield",
                    name : "Q_personNo_S_LK",
                    maxLength : 256
                } ]
            },
            grid : {
                title : "健康档案列表",
                rowActions:true,
                listUrl : __ctxPath + "/health/listHealthFile.do",
                removeUrl : __ctxPath + "/health/deleteHealthFile.do",
                fields : [ "id", 'years', 'personNo','personName', "age", "sex","telephone","occupation","department","workType","post","factorName"],
                columns : [ {
                    header : "id",
                    dataIndex : "id",
                    hidden : true
                }, {
                    header : "年份",
                    dataIndex : "years",
                    hidden : true,
                    sortable : true
                },{
                    header : "员工编号",
                    dataIndex : "personNo",
                    width : 70
                },{
                    header : "姓名",
                    dataIndex : "personName",
                    width : 80
                },{
                    header : "年龄",
                    dataIndex : "age",
                    width : 70
                },{
                    header : "性别",
                    dataIndex : "sex",
                    width : 70,
                    renderer : function(j,i,g,m,h){
                        if(j==1){
                            return "男";
                        }else if(j==2){
                            return "女";
                        }
                    }
                },{
                    header : "联系电话",
                    dataIndex : "telephone",
                    width : 70
                },{
                    header : "职务",
                    dataIndex : "occupation",
                    width : 70
                },{
                    header : "部门",
                    dataIndex : "department",
                    width : 70
                },{
                    header : "工种",
                    dataIndex : "workType",
                    width : 70
                },/*{
                    header : "岗位",
                    dataIndex : "post",
                    width : 70
                },{
                    header : "涉及危害因素",
                    dataIndex : "factorName",
                    width : 70
                },*/{
                    header : "体检记录",
                    dataIndex : "id",
                    width : 50,
                    renderer : function(j, i, g, m, h) {
                        var cfg={
                               healthFileId : g.data.id
                        }
                        var k = "";
                                k += '<button title="体检记录" value="" class="btn-showDetail" onclick=\'HealthFileView.record('
                                    + JSON.stringify(cfg) + ')\'></button>';
                        return k;
                    }
                }
            ]
            },
            tree : {
                treeUrl : __ctxPath + "/health/treeLoadHealthFile.do"
            }
            
        });
        return yearGridComponents;
    }
});
HealthFileView.record = function(healthFile){
    new PhysicalRecordWindow({
        healthFileId : healthFile.healthFileId
    }).show();
};

